﻿using System.Windows;
using System.Windows.Controls;
using TabControlLib.Controls;

namespace WpfApp1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private int _tabCounter = 1;

        public MainWindow()
        {
            InitializeComponent();
        }

        private void AddTab_Click(object sender, RoutedEventArgs e)
        {
            var newTab = new TabControlLib.Controls.TabItem
            {
                Header = $"New Tab {_tabCounter}",
                Content = new TabControlLib.Controls.ScrollViewer
                {
                    IsInertiaEnabled = true,
                    CanMouseWheel = true,
                    Content = new TextBlock
                    {
                        Text = $"This is the content of New Tab {_tabCounter}.\n\nTry these features:\n" +
                              "• Drag this tab to move it\n" +
                              "• Click X or middle-click to close\n" +
                              "• Right-click for context menu",
                        Margin = new Thickness(10),
                        TextWrapping = TextWrapping.Wrap
                    }
                }
            };

            TabControl.Items.Add(newTab);
            newTab.IsSelected = true;
            _tabCounter++;
        }

        private void CloseTab_Click(object sender, RoutedEventArgs e)
        {
            if (TabControl.SelectedItem is TabControlLib.Controls.TabItem selectedTab)
            {
                selectedTab.Close();
            }
        }
    }
}
